package com.jstyle.jclifexd.NetWork.api;
import com.jstyle.jclifexd.model.ActivitvtiesData;
import com.jstyle.jclifexd.model.ActivitvtiesPK;
import com.jstyle.jclifexd.model.Activitvtiesmsg;
import com.jstyle.jclifexd.model.Activitvtiesteam;
import com.jstyle.jclifexd.model.AppUpdateData;
import com.jstyle.jclifexd.model.Created;
import com.jstyle.jclifexd.model.JoinUserResult;
import com.jstyle.jclifexd.model.NetResultData;
import com.jstyle.jclifexd.model.QueryUserStatemsg;
import com.jstyle.jclifexd.model.RankData;
import com.jstyle.jclifexd.model.Recordmian;
import com.jstyle.jclifexd.model.RootRecord;
import com.jstyle.jclifexd.model.SosContact;
import com.jstyle.jclifexd.model.UpdateData;
import com.jstyle.jclifexd.model.UploadData;
import com.jstyle.jclifexd.model.UploadGpsData;
import com.jstyle.jclifexd.model.UserInfoQuery;
import com.jstyle.jclifexd.model.gomore.FindInfo;
import com.jstyle.jclifexd.model.gomore.GomoreInfo;
import com.jstyle.jclifexd.model.gomore.GomoreUserInfo;
import com.jstyle.jclifexd.model.gomore.GomoreWorkdData;
import com.jstyle.jclifexd.model.gomore.StravasTokenInfo;
import com.jstyle.jclifexd.model.gomore.StravasUploads;
import com.jstyle.jclifexd.model.googleinfo.ResultRoot;
import com.jstyle.jclifexd.model.googleinfo.SeachResultRoot;
import java.util.Map;
import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
import retrofit2.http.Streaming;
import retrofit2.http.Url;


/**
 * Created by Administrator on 2017/3/24.
 */

public interface JstyleApi {
    String baseurl="https://app.le-young.com/";
     String Gomorebaseurl="https://cnsandbox.gomore.club/v2/api/";
    // String baseurl="http://192.168.0.111/";

    @GET("sms/send")
    Observable<NetResultData> getSmsCode(@QueryMap Map<String, Object> userMap);

    @GET("sms/sendEmail")
    Observable<NetResultData> getEmailCode(@QueryMap Map<String, Object> userMap);

    @FormUrlEncoded
    @POST("user/register")
    Observable<NetResultData> register(@FieldMap Map<String, Object> userMap);

    @FormUrlEncoded
    @POST("user/login")
    Observable<NetResultData<String>> login(@FieldMap Map<String, Object> userMap);

    @FormUrlEncoded
    @POST("user/retrieve")
    Observable<NetResultData> findPassword(@FieldMap Map<String, Object> userMap);

    @FormUrlEncoded
    @POST("user/loginAuth")
    Observable<NetResultData<String>> loginAuth(@FieldMap Map<String, Object> userMap);

    @GET("user/validateToken")
    Observable<NetResultData> getUserId(@Query("query") boolean query, @Query("token") String token);

    @FormUrlEncoded
    @POST("user/updatePwd")
    Observable<NetResultData> changePsd(@FieldMap Map<String, Object> maps);


    @POST(baseurl+"jcloud/jclifedata/data/save")
    Observable<NetResultData> uploadData(@Body UploadData uploadData);

    @POST(baseurl+"jcloud/jclifedata/data/saveGps")
    Observable<NetResultData> uploadGpsData(@Body UploadGpsData uploadData);

    @FormUrlEncoded
    @POST("user/updatePhone")
    Observable<NetResultData> changePhone(@FieldMap Map<String, Object> maps);
    @FormUrlEncoded
    @POST("https://api.le-young.com/intlsso/opinion/save")
    Observable<NetResultData> feedBack(@FieldMap Map<String, String> maps);

    @FormUrlEncoded
    @POST(baseurl+"jcloud/usercenter/applog/save")
    Observable<NetResultData> uploadOtaLog(@FieldMap Map<String, String> maps);

    @GET("http://api.le-young.com/device/firmware/v2/update")
    Observable<UpdateData> queryDeviceVersion(@QueryMap Map<String, String> versionMap);

    @GET("https://api.le-young.com/device/resource/updategps?type=1755")
    Observable<NetResultData> downLoadGpsFile();


    @Streaming
    @GET
    Observable<ResponseBody> downloadPath(@Url String url);

    @Streaming
    @GET
    Observable<ResponseBody> downloadIcon(@Url String url);

    @GET("https://api.le-young.com/device/appupdate/query")
    Observable<AppUpdateData> queryAppVersion(@QueryMap Map<String, String> versionMap);

    /**
     * 领英分享的图片上传
     *
     * @param file
     * @param maps
     * @return
     */
    @Multipart
    @POST("share/upImg")
    Observable<NetResultData<String>> updateImage(@Part MultipartBody.Part file, @PartMap Map<String, RequestBody> maps);

    @GET("https://api.le-young.com/intlsso/userInfo/query")
    Observable<NetResultData<UserInfoQuery>> getUserInfo(@Query("uid") String token);

    @FormUrlEncoded
    @POST("https://api.le-young.com/intlsso/userInfo/save")
    Observable<NetResultData<String>> saveUserInfo(@FieldMap Map<String, String> userInfo);

    @GET("http://api.le-young.com/pushServer/api/sos/queryAll")
    Observable<SosContact> getAllContact(@Query("uid") String token);

    @POST("https://api.le-young.com/pushServer/api/sos/delete")
    Observable<SosContact> deleteContact(@Query("id") String token);

    @POST("https://api.le-young.com/pushServer/api/sos/update")
    Observable<SosContact> editContact(@Query("id") String token, @Query("uid") String uid, @Query("uname") String uName, @Query("phone") String phone, @Query("remake") String remake);

    @POST("https://api.le-young.com/pushServer/api/sos/add")
    Observable<SosContact> addContact(@Query("uid") String uid, @Query("uname") String uName, @Query("phone") String phone, @Query("remake") String remake);

    @POST("https://api.le-young.com/pushServer/api/sos/sos")
    Observable<SosContact> sendSos(@Query("uid") String uid, @Query("lat") String lat, @Query("lng") String lng);

    @GET("user/queryActivate")
    Observable<NetResultData<UserInfoQuery>> activateQuery(@Query("uid") String token);

    @Multipart
    @POST("userInfo/avatar")
    Observable<NetResultData<String>> updateIcon(@Part MultipartBody.Part file, @PartMap Map<String, RequestBody> map);

    @GET(baseurl+"jcloud/jclifedata/rank/activity/day")//日排行
    Observable<RankData> getRank(@QueryMap Map<String, Object> userMap);

    @GET(baseurl+"jcloud/jclifedata/rank/activity/month")//总排行
    Observable<RankData> getTotalRank(@QueryMap Map<String, Object> userMap);

    @GET(baseurl+"jcloud/jclifedata/appResources/queryBanner")//获取活动
    Observable<ActivitvtiesData> getActivity(@QueryMap Map<String, Object> userMap);

    @GET(baseurl+"jcloud/jclifedata/activites/queryUserState")//查询用户是否加入战队/是否参与活动
    Observable<QueryUserStatemsg> getqueryUserState(@QueryMap Map<String, Object> userMap);

    @GET(baseurl+"jcloud/jclifedata/activites/query")//查询活动信息
    Observable<ActivitvtiesData> getquery(@QueryMap Map<String, Object> userMap);

    @GET(baseurl+"jcloud/jclifedata/team/info/queryAll")//战队查询
    Observable<Activitvtiesteam> getqueryAll();

    @GET(baseurl+"jcloud/jclifedata/team/queryMember")//查询战队成员
    Observable<Activitvtiesteam> getqueryMember(@QueryMap Map<String, Object> userMap);

    @POST(baseurl+"jcloud/jclifedata/team/join")//加入战队
    Observable<Activitvtiesmsg> join(@QueryMap Map<String, Object> userMap);

    @POST(baseurl+"jcloud/jclifedata/activites/join")//加入活动
    Observable<Activitvtiesmsg> huodongjoin(@QueryMap Map<String, Object> userMap);

    @POST(baseurl+"jcloud/jclifedata/team/quitTeam")//退出战队
    Observable<Activitvtiesmsg> quitTeam(@QueryMap Map<String, Object> userMap);

    @POST(baseurl+"jcloud/jclifedata/activites/quit")//退出活动
    Observable<Activitvtiesmsg> quit(@QueryMap Map<String, Object> userMap);

    @POST(baseurl+"jcloud/jclifedata/activites/delete")//取消活动
    Observable<Activitvtiesmsg> deleteactivity(@QueryMap Map<String, Object> userMap);


    @GET(baseurl+"jcloud/jclifedata/team/pk/result")//战队pk排名
    Observable<ActivitvtiesPK> pkresult(@QueryMap Map<String, Object> userMap);

    @GET(baseurl+"jcloud/jclifedata/activites/rank")//查询活动排行
    Observable<RankData> rank(@QueryMap Map<String, Object> userMap);


    @POST(baseurl+"jcloud/jclifedata/team/liked/add")//点赞/取消点赞为同一个接口
    Observable<Activitvtiesmsg> liked(@QueryMap Map<String, Object> userMap);

    @POST(baseurl+"jcloud/jclifedata/activites/liked/add")//活动点赞/取消点赞为同一个接口
    Observable<Activitvtiesmsg> huodongliked(@QueryMap Map<String, Object> userMap);

    @GET(baseurl+"jcloud/jclifedata/growth/queryMonthRecord")//查询月成长记录
    Observable<Recordmian> queryMonthRecord(@QueryMap Map<String, Object> userMap);


    @GET(baseurl+"jcloud/jclifedata/growth/queryYearRecord")//查询月成长记录
    Observable<Recordmian> queryYearRecord(@QueryMap Map<String, Object> userMap);

    @GET(baseurl+"jcloud/jclifedata/growth/queryGrade")//成绩查询
    Observable<RootRecord> queryGrade(@QueryMap Map<String, Object> userMap);
    @Multipart
    @POST(baseurl+"jcloud/jclifedata/activites/uploadPoster")//上传活动图片
    Observable<NetResultData<String>> uploadPoster(@Part MultipartBody.Part file, @PartMap Map<String, RequestBody> map);


    @POST(baseurl+"jcloud/jclifedata/activites/create")//创建活动
    Observable<Activitvtiesmsg> create(@QueryMap Map<String, Object> userMap);

    @GET(baseurl+"jcloud/jclifedata/activites/queryAll")//查询活动
    Observable<Created> queryAll(@QueryMap Map<String, Object> userMap);

    @GET("https://maps.googleapis.com/maps/api/place/nearbysearch/json?")//点击google地图返回地址列表
    Observable<ResultRoot> googleSeach(@QueryMap Map<String, Object> userMap);

    @GET("https://maps.googleapis.com/maps/api/geocode/json?")//通过输入类容搜索
    Observable<SeachResultRoot> googleInputSeach(@QueryMap Map<String, Object> userMap);

    @GET(baseurl+"jcloud/jclifedata/activites/queryJoinUser")//查询活动成员列表(不含pk)
    Observable<JoinUserResult> queryJoinUser(@QueryMap Map<String, Object> userMap);

    @POST(baseurl+"jcloud/jclifedata/push/save")//保存用户app推送信息
    Observable<Activitvtiesmsg> save(@QueryMap Map<String, Object> userMap);

    @GET(baseurl+"jcloud/jclifedata/activites/queryAuditAll")//查询审核列表
    Observable<Created> queryAuditAll(@QueryMap Map<String, Object> userMap);

    @POST(baseurl+"jcloud/jclifedata/activites/saveAuditResult")//提交审核结果
    Observable<Activitvtiesmsg> saveAuditResult(@QueryMap Map<String, Object> userMap);



    @GET(baseurl+"jcloud/jclifedata/gomore/query")//查询是否已经上传了当前数据（单条数据）
    Observable<FindInfo> Findquery(@QueryMap Map<String, Object> userMap);

    @POST(baseurl+"jcloud/jclifedata/gomore/save")//保存单条数据
    Observable<FindInfo> Savequery(@QueryMap Map<String, Object> userMap);

    @FormUrlEncoded
    @POST(Gomorebaseurl+"login/login.php")//Gomore登录
    Observable<GomoreUserInfo> GomoreLogin(@FieldMap Map<String, Object> userMap);

    @FormUrlEncoded
    @POST(Gomorebaseurl+"user/edit.php")//Gomore编辑用户信息
    Observable<GomoreUserInfo> GomoreEdit(@FieldMap Map<String, Object> userMap);

    @FormUrlEncoded
    @POST(Gomorebaseurl+"workout/calculate.php")//数据是否已处理
    Observable<GomoreUserInfo> isOK(@FieldMap Map<String, Object> userMap);


    @Multipart
    @POST(Gomorebaseurl+"workout/upload.php")//Gomore上传数据
    Observable<GomoreUserInfo> GomoreUpload(@Part MultipartBody.Part file,@PartMap Map<String, RequestBody> map);

    @FormUrlEncoded
    @POST(Gomorebaseurl+"workout/workout_data.php")//查询数据
    Observable<GomoreWorkdData> GomoreWorkoutData(@FieldMap Map<String, Object> userMap);

    @FormUrlEncoded
    @POST(Gomorebaseurl+"login/check_user_token.php")//刷新token
    Observable<GomoreUserInfo> check_user_token(@FieldMap Map<String, Object> userMap);




    @GET("https://www.strava.com/oauth/mobile/authorize")
    Observable<Object> stravalogon(@QueryMap Map<String, Object> userMap);

    @GET(baseurl+"jcloud/jclifedata/strava/queryLastTime")//查询用户最后上传数据时间
    Observable<GomoreInfo> queryLastTime(@QueryMap Map<String, Object> userMap);

    @POST(baseurl+"jcloud/jclifedata/strava/saveLastTime")//保存用户最后上传数据的时间
    Observable<GomoreInfo> saveLastTime(@QueryMap Map<String, Object> userMap);

    @FormUrlEncoded
    @POST("https://www.strava.com/oauth/token")//Strvastoken
    Observable<StravasTokenInfo> Strvastoken(@FieldMap Map<String, Object> userMap);

    @Multipart
    @POST("https://www.strava.com/api/v3/uploads")//上传数据
    Observable<StravasUploads> Strvasuploads(@Header("Authorization")String accessToken, @Part MultipartBody.Part file, @PartMap Map<String, RequestBody> map);


    @POST(baseurl+"jcloud/usercenter/third/save")//查询/获取 第三方登录信息
    Observable<GomoreInfo> thirdinfo(@QueryMap Map<String, Object> userMap);
}
